# 美团笔试第一题
'''import sys

n = 0
for line in sys.stdin:
    n = int(line.split()[0])
    break

l_list = []
for line in sys.stdin:
    temp = line.split()
    for i in range(n):
        l_list.append(int(temp[i]))
    break

x = 0
y = 0
for line in sys.stdin:
    input_ = line.split()
    x = int(input_[0])
    y = int(input_[1])
    break

for i in range(len(l_list)):
    if x == l_list[i] and i >= 1 and i < len(l_list)-1:
        if y == l_list[i-1] or y == l_list[i+1]:
            print("Yes")
        else:
            print("No")
    if x == l_list[i] and i == 0:
        if y == l_list[i+1]:
            print("Yes")
        else:
            print("No")
    if x == l_list[i] and i == len(l_list)-1:
        if y == l_list[i-1]:
            print("Yes")
        else:
            print("No")'''

# 美团笔试第二题
'''import sys

n = 0
for line in sys.stdin:
    n = int(line.split()[0])
    break

l_list = []
for line in sys.stdin:
    temp = line.split()
    for i in range(n):
        l_list.append(int(temp[i]))
    break

x = 0
y = 0
for line in sys.stdin:
    input_ = line.split()
    x = int(input_[0])
    y = int(input_[1])
    break

shun = 0
ni = 0
if x == y:
    print(0)
if x < y:
    for i in range(x, y):
        shun += l_list[i - 1]
    for i in range(1, x):
        ni += l_list[i - 1]
    for i in range(y-1, len(l_list)):
        ni += l_list[i - 1]
    if shun < ni:
        print(shun)
    else:
        print(ni)
if x > y:
    for i in range(y, x):
        ni += l_list[i - 1]
    for i in range(1, y):
        shun += l_list[i - 1]
    for i in range(x-1, len(l_list)):
        shun += l_list[i - 1]
    if shun < ni:
        print(shun)
    else:
        print(ni)'''

# 美团笔试第三题
'''import sys

r = 0
c = 0
for line in sys.stdin:
    temp = line.split()
    r = int(temp[0])
    c = int(temp[1])
    break

l_total = []
for i in range(r):
    l_list = []
    for line in sys.stdin:
        temp = line.split()
        for i in range(c):
            l_list.append(int(temp[i]))
        l_total.append(l_list)
        break

if r == 1 and c == 1:
    print(l_total[0][0])
else:
    cha = []
    # 每行割一次
    for row in range(1, r):
        half_1 = 0
        half_2 = 0
        # 上方
        for i in range(0, row):
            for j in l_total[i]:
                half_1 += j
        # 下方
        for i in range(row, r):
            for j in l_total[i]:
                half_2 += j

        if half_1 >= half_2:
            cha.append(half_1 - half_2)
        else:
            cha.append(half_2 - half_1)

    # 每列割一次
    for col in range(1, c):
        half_1 = 0
        half_2 = 0
        # 左边
        for k in range(len(l_total)):
            for i in range(0, col):
                    half_1 += l_total[k][i]
        # 右边
        for k in range(len(l_total)):
            for i in range(col, c):
                    half_2 += l_total[k][i]

        if half_1 >= half_2:
            cha.append(half_1 - half_2)
        else:
            cha.append(half_2 - half_1)

    print(min(cha))'''

# 美团笔试第四题

